| Conditions | 3 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 14 | |||
| 15 | public async execute({ id, currentUserId }: RemoveUserCommand): Promise<void> { |
||
| 16 | if (id === currentUserId) { |
||
| 17 | throw new CantRemoveYourselfException(); |
||
| 18 | } |
||
| 19 | |||
| 20 | const user = await this.userRepository.findOneById(id); |
||
| 21 | |||
| 22 | if (!user) { |
||
| 23 | throw new UserNotFoundException(); |
||
| 24 | } |
||
| 25 | |||
| 26 | await this.userRepository.remove(user); |
||
| 27 | } |
||
| 29 |